// 启动服务器
const express = require('express');
// const bodyParser = require('body-parser');
// 创建一个 应用程序
const app = express();

// 定义中间件
const middleware1 = (req, res, next) => {
  console.log('1');
  next();
  console.log('1-1');
}
const middleware2 = (req, res, next) => {
  console.log('2');
  next();
  console.log('2-2');
}
const middleware3 = (req, res, next) => {
  console.log('3');
  next();
  console.log('3-3');
}
// 使用中间件
app.use(middleware1);
app.use(middleware2);
app.use(middleware3);
app.get('/home', (req, res) => {
  res.send('我是home路由22222')
})

// post路由
app.post('/login', (req,res) => {
  // console.log(req.body);
  res.send('login的post请求')
})

app.listen(9527, () => {
  console.log('start at port 9527');
})